﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Android.Text;
using Android.Text.Style;
using Java.Lang;
using MonoTouch.SQLite;
using LinkNote.Model;
using Object = Java.Lang.Object;
using String = System.String;

namespace LinkNote.Core
{
    /*public class MyHtmlTagHandler : TagHandler {
 
        public void handleTag(bool opening, String tag, IEditable output,
                XmlReader xmlReader) {
            if(tag.Equals("strike", StringComparison.CurrentCultureIgnoreCase) || tag=="s") {
                processStrike(opening, output);
            }
        }
 
        private void processStrike(bool opening, IEditable output) {
            int len = output.Length();
            if(opening) {
                output.SetSpan(new StrikethroughSpan(), len, len, SpanTypes.MarkMark);
            } else {
                Object obj = getLast(output, (new StrikethroughSpan()).Class);
                int where = output.GetSpanStart(obj);
 
                output.RemoveSpan(obj);
 
                if (where != len) {
                    output.SetSpan(new StrikethroughSpan(), where, len, SpanTypes.ExclusiveExclusive);
                }
            }
        }
 
        private Object getLast(IEditable text, Class kind) {
            Object[] objs = text.GetSpans(0, text.Length(), kind);
 
            if (objs.Length == 0) {
                return null;
            } else {
                for(int i = objs.Length;i>0;i--) {
                    if (text.GetSpanFlags(objs[i - 1]) == SpanTypes.MarkMark)
                    {
                        return objs[i-1];
                    }
                }
                return null;
            }
        }
    }*/
}
